<template>
  <work-template @closeSelectedTag="closeSelectedTag" :flowId="flowId" :butShow="false">
    <div v-loading="loading" slot="form">
      <!--基础信息-->
      <basicsInfoMessage v-model="ruleForm"/>
      <!--还车信息-->
      <returnCarMessage v-model="ruleForm"/>
      <!--还车结算-->
      <returnCarSettleMessage v-model="ruleForm" state="readonly"/>
    </div>

  </work-template>
</template>

<script>
import * as apis from "@/api/returnMargin";
import {queryDetails} from "@/api/returnMargin";

export default {
  name: 'ReturnMarginDetails',//查看
  components: {
    //基础信息
    basicsInfoMessage: () => import('./components/basicsInfoMessage.vue'),
    //还车信息
    returnCarMessage: () => import('./components/returnCarMessage.vue'),
    //还车结算
    returnCarSettleMessage: () => import('./components/returnCarSettleMessage.vue'),
  },
  computed: {
    flowId() {
      return this.$route.query?.flowId
    }
  },
  watch: {},
  data() {
    return {
      ruleForm: {},
      loading: false
    };
  },
  created() {
    if (this.$route.query.id) {
      this.handleDetails(this.$route.query.id)
    }
  },
  mounted() {
  },
  methods: {
    async handleDetails(id) {
      this.loading = true
      try {
        let res = await apis?.queryDetails(id)
        this.ruleForm = res?.data || {}
      } catch (e) {
        console.error(e)
      } finally {
        this.loading = false
      }
    },

    closeSelectedTag() {
      this.$tab.closePage().then(({visitedViews}) => {
        this.$router.push({
          path: "/ReturnCar/ReturnMarginList",
        });
      });
    }
  },
};
</script>

<style scoped lang=""></style>


